<?php
$_doc = array();
$_doc['title'] = L('tab_media_list');
$_doc['extra'] = '<link rel="stylesheet" type="text/css" href="'.__CURRENT__.'/pMedia.css" />'.
                '<script type="text/javascript" src="'.__CURRENT__.'/pMedia.js"></script>'.
                '<script type="text/javascript" src="'.__CURRENT__.'/../fancyupload/Swiff.Uploader.js"></script>';
?>
<include file="pAdmin:header" />
<script type="text/javascript">
    var URL = '__URL__';
    var TMPL = '__TMPL__';
    var flHash = new Hash();
    var flHashSize = 0;
    var rootdir = '{$root}';
    var subdir = '{$subdir}';
    var Lang = {};
    Lang['action_removal'] = '<?php echo L('action_removal');?>';
</script>
<div class="main">
    <div id="dirbar" class="radius6">
        <span id="uploadImgSpan" class="btn">
            <span>
                <?php echo L('action_upload');?>
            </span>
        </span>
        <span><?php echo L('currentPathIs');?></span>
        <span id="dirlist"><label id="labRoot" onclick="jumpRoot('{$root}')">{$rootName}</label></span>
    </div>
    <ul class="fnc">
        <li><button type="button" class="btn" onclick="create_directory();">{%action_new_directory}</button></li>
    </ul>
    <form name="explorerForm" method="post" action="__URL__">
        <input type="hidden" name="a">
        <input type="hidden" name="root" value="{$root}"/>
        <input type="hidden" name="subdir" value="{$subdir}" />
        <input type="hidden" name="filename" />
        <table class="data" id="gridInst">
            <thead>
                <tr>
                    <th class="cbCell roundedleft"><input type="checkbox" id="effectAll" /></th>
                    <th>{%fileName}</th>
                    <th>{%lastModified}</th>
                    <th>{%size}</th>
                    <th class="roundedright">{%action}</th>
                </tr>
            </thead>
            <tbody id="dirtbody" class="grid">
                <?php $iterateIndex=0; ?>
                <iterate name="folders" id="vo">
                <?php if ( false=== strstr($vo['fileName'],'.')): ?>
                    <tr id="fileTR<?php echo $iterateIndex;?>">
                        <td></td>
                        <td><label class='ext ext-folder' onclick="godir('{$vo['fileName']}');">{$vo['fileName']}</label></td>
                        <td>{$vo['lastModified']}</td>
                        <td>--</td>
                        <td></td>
                    </tr>
                <?php $iterateIndex++;?>
                <?php endif;?>
                </iterate>
            </tbody>
            <tbody id="filetbody" class="grid">
                <iterate name="files" id="vo">
                    <tr id="fileTR<?php echo $iterateIndex;?>">
                        <td><input type="checkbox" name="sid[]" value="{$vo['fileName']}"/></td>
                        <td>
                            <a class="afile ext ext-{$vo['ext']}" >{$vo['fileName']}</a>
                            <script type="text/javascript">
                            flHash.set('<?php echo $iterateIndex;?>','{$vo['fileName']}');
                            </script>
                        </td>
                        <td>{$vo['lastModified']}</td>
                        <td>{$vo['size']}</td>
                        <td>
                            <a onclick="renameFile(this)">{%action_rename}</a>
                            <a onclick="deleteFile(this)">{%action_removal}</a>
                        </td>
                    </tr>
                    <?php $iterateIndex++;?>
                </iterate>
            </tbody>
        </table>
        <script type="text/javascript"> flHashSize=<?php echo $iterateIndex;?>; </script>
    </form>
    <ul class="fnc">
        <li><button type="button" class="btn" onclick="create_directory();">{%action_new_directory}</button></li>
    </ul>
</div>
<include file="pAdmin:footer" />
